{% extends "base.html" %}

{% block title %}Pay Op{% endblock %}
{% block heading %}Payout for {{op.op_date|date:"m-d"}} {{op.name}}{% endblock %}

{% block leftmenu %}
	<a href='/listops'>Operations List</a><br/>
	<a href='/multipay'>Multipay</a><br/>
	<a href='/stats'>Stats</a><br/>
{% endblock %}

{% block content %}
	<form action='/payop' method='post' id='mainform' name='mainform'>
		<input type='hidden' name='key' value='{{op.key}}' />		
		<table border='0'>
			<tr>
				<td colspan='6'>ISK Calculator:-</td>
			</tr>
			<tr>
				<td align='right' colspan='2'>Salvage ISK:</td>
				<td colspan='4'>
					<input type='text' size='10' id='salvage_isk' name='salvage_isk' value='{{op.salvage_isk}}' />
				</td>
			</tr>
			<tr>
				<td colspan='2'>&nbsp;</td>
				<td>Ancient Coords</td>
				<td>Neural Net</td>
				<td>Data Lib</td>
				<td>Drone AI</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td align='right'>Count:</td>
				<td><input type='text' size='4' name='ancient_coord_count' value='{{op.ancient_coord_count}}' /></td>
				<td><input type='text' size='4' name='neural_net_count' value='{{op.neural_net_count}}' /></td>
				<td><input type='text' size='4' name='data_lib_count' value='{{op.data_lib_count}}' /></td>
				<td><input type='text' size='4' name='drone_ai_count' value='{{op.drone_ai_count}}' /></td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td align='right'>Value:</td>
				<td><input type='text' size='10' name='ancient_coord_isk' value='{{pilot.ancient_coord_isk}}' /></td>
				<td><input type='text' size='10' name='neural_net_isk' value='{{pilot.neural_net_isk}}' /></td>
				<td><input type='text' size='10' name='data_lib_isk' value='{{pilot.data_lib_isk}}' /></td>
				<td><input type='text' size='10' name='drone_ai_isk' value='{{pilot.drone_ai_isk}}' /></td>
			</tr>
			<tr>
				<td colspan='6' >&nbsp;</td>
			</tr>
			<tr>
				<td>Total ISK:</td>
				<td align='right'>{{op.op_isk_000}}</td>
				<td colspan='4'>
					<input type='text' size='10' name='isk' value='{{op.isk|floatformat:0}}' /> &nbsp;
					<i>only used if salvage isk is 0</i>
				</td>
			</tr>
			<tr>
				<td>Paid:</td>
				<td align='right'>{{op.paid}}</td>
				<td>
					<input type='checkbox' name='paid' value='paid'
					{% if op.paid %}
						checked
					{% endif %}
					/>					
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<td align='left'><input type='submit' value='Update' /></td>
				<td>
					<select name="next">
						<option {% ifequal pilot.payop_next 'this' %}selected='selected' {% endifequal %} value='this'>this page</option>
						<option {% ifequal pilot.payop_next 'multipay' %}selected='selected' {% endifequal %} value='multipay'>multipay</option>
					</select>
					&nbsp;next
				</td>
			</tr>	
			<tr>
				<td valign='top'>Pilots:</td>
				<td valign='top' align='right'>{{op.pilots|length}}</td>
			</tr>
			<tr>
				<td valign='top'>Pay Strategy:</td>
				<td>&nbsp;</td>
				<td><input type='text' name='pay_strategy' size='3' value='{{op.pay_strategy}}' /></td>
			</tr>
			<tr>
				<td>Corp ISK:</td>
				<td align='right'>{{op.corp_isk_000}} isk</td>
				<td><input type='text' name='corp_tax' size='4' value='{{op.corp_tax}}' />%</td>
			</tr>
			<tr>
				<td>FC ISK:</td>
				<td align='right'>{{op.fc_isk_000}}</td>
				<td colspan='4'><i>(including bonus)</i></td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td align='right'>
				{% ifnotequal op.fc_id "-1" %}
					(<a href='#' onClick="CCPEVE.showInfo(1377, {{op.fc_id}})">{{ op.fc }}</a>)
				{% else %}
					{{ op.fc }}
				{% endifnotequal %}
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td valign='top'>Pilot ISK:</td>
				<td valign='top' align='right'>{{op.pilot_isk_000}}</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td align='right'>
					{% for pilot1 in op.pilot_details %}						
						{% ifnotequal pilot1.char_name op.fc %}
							{% ifequal pilot1.char_id "-1" %}
								{{ pilot1.char_name }}
							{% else %}
								<a href='#' onClick="CCPEVE.showInfo(1377, {{pilot1.char_id}})">{{ pilot1.char_name }}</a>
							{% endifequal %}
							<br/>
						{% endifnotequal %}
					{% endfor %}
				</td>
			</tr>
		</table>

	</form>

	<script type="text/javascript">
		document.mainform.salvage_isk.focus();
		document.mainform.salvage_isk.select();
	</script>
{% endblock %}
